package com.aaa.service.impl;

import com.aaa.entity.Branch;
import com.aaa.entity.Staff;
import com.aaa.mapper.BranchMapper;
import com.aaa.service.BranchService;
import com.aaa.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;
@Service
public class BranchServiceImpl implements BranchService {
    @Autowired
    private BranchMapper branchMapper;
    @Autowired
    private HttpSession session;
    @Override
    public R findAll() {
        Staff staff = (Staff) session.getAttribute("staff");
        Integer branchId=null;
        if(staff.getStaffid()!=111){
            branchId=staff.getBranchid();
        }
        List<Branch> branches= branchMapper.selectAll(branchId);
        return new R(200,"查询成功",branches);
    }
}
